package main

import (
	"fmt"
	"strconv"
	"sync"
)

var m = sync.Map{}
var temp = sync.WaitGroup{}

func main() {

	for i := 0; i < 10; i++ {
		temp.Add(1)
		go func(n int) {
			itoa := strconv.Itoa(n)
			m.Store(itoa, i)
			//取值
			value, _ := m.Load(itoa)
			fmt.Println("从map中取值", value)
			temp.Done()
		}(i)
	}
	temp.Wait()
}
